package com.casper.codechef;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Lucky {

	public static void main(String[] args) throws IOException {
		String a;
		String b;
		BufferedReader bufferedReader = new BufferedReader(
				new InputStreamReader(System.in));
		int mTestCases = Integer.parseInt(bufferedReader.readLine());
		for (int i = 0; i < mTestCases; i++) {
			 a = bufferedReader.readLine();
			 b = bufferedReader.readLine();
			for (int j = 0; j < a.length(); j++) {
				char x;
				if((x = Character.getNumericValue(a.charAt(j)) > Character
						.getNumericValue(b.charAt(j)) ? (a.charAt(j)) : (b
						.charAt(j)))=='7')
				 {
					System.out.print(x);
				}
			}
			System.out.println();
		}

	}

}
